//
//  ViewController.m
//  UI_0715_HomeWork
//
//  Created by GivenBmli on 16/7/15.
//  Copyright © 2016年 GivenBmli. All rights reserved.
//

#import "ViewController.h"

#define WIDTH self.view.frame.size.width
#define HEIGHT self.view.frame.size.height
@interface ViewController ()
/**背景图片*/
@property (nonatomic, retain)UIImageView *backgroundView;
/**忘记密码背景*/
@property (nonatomic, retain)UIImageView *forgotPasswordView;
/**LoGo*/
@property (nonatomic, retain)UIImageView *LogoView;
/**用户名背景*/
@property (nonatomic, retain)UIView *nameTextBackground;
/**用户名输入框*/
@property (nonatomic, retain)UITextField *nameTextField;
/**用户名图片*/
@property (nonatomic, retain)UIImageView *nameImageView;
/**分隔线*/
@property (nonatomic, retain)UIView *separatedView;
/**密码输入框*/
@property (nonatomic, retain)UITextField *passWordTextField;
/**密码图片*/
@property (nonatomic, retain)UIImageView *passWordImageView;
/**忘记密码*/
@property (nonatomic, retain)UIButton *forgotPasswordButton;
/**登录*/
@property (nonatomic, retain)UIButton *registerButton;
/**注册*/
@property (nonatomic, retain)UIButton *registeredButton;
/**OR*/
@property (nonatomic, retain)UILabel *orLabel;
/**Or右白线*/
@property (nonatomic, retain)UIView *leftWhiteLine;
/**Or左白线*/
@property (nonatomic, retain)UIView *rightWhiteLine;
/**返回*/
@property (nonatomic, retain)UIButton *returnButton;
/**下一步*/
@property (nonatomic, retain)UIButton *nextSteplButton;
/**验证手机*/
@property (nonatomic, retain)UILabel *validationPhone;


@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
/**背景图片*/
    self.backgroundView = [[UIImageView alloc]initWithFrame:[UIScreen mainScreen].bounds];
    self.backgroundView.backgroundColor = [UIColor whiteColor];
    self.backgroundView.image = [UIImage imageNamed:@"welcome_2.jpg"];
    [self.view addSubview:self.backgroundView];
/**LoGo*/
    self.LogoView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, WIDTH / 3 - 10, HEIGHT * 2 / 7)];
    self.LogoView.center = CGPointMake(self.view.frame.size.width / 2, self.view.frame.size.height / 4);

    self.LogoView.image = [UIImage imageNamed:@"logo2x.png"];
    [self.view addSubview:self.LogoView];
/**用户名和密码背景*/
    self.nameTextBackground = [[UIView alloc]initWithFrame:CGRectMake(10, 370, WIDTH - 20, 91)];
    self.nameTextBackground.backgroundColor = [UIColor blackColor];
    self.nameTextBackground.alpha = 0.3;
    [self.view addSubview:self.nameTextBackground];
/**用户名输入框*/
    self.nameTextField = [[UITextField alloc]initWithFrame:CGRectMake(55, 0, WIDTH - 20 - 55, 45)];
    self.nameTextField.backgroundColor = [UIColor grayColor];
    self.nameTextField.alpha = 0.3;
    [self.nameTextBackground addSubview:self.nameTextField];
/**用户名图片*/
    self.nameImageView = [[UIImageView alloc]initWithFrame:CGRectMake(12, 5, 30, 35)];
    self.nameImageView.backgroundColor =[UIColor clearColor];
    self.nameImageView.image = [UIImage imageNamed:@"Me3x.png"];
    [self.nameTextBackground addSubview:self.nameImageView];
/**分隔线*/
    self.separatedView =[[UIView alloc]initWithFrame:CGRectMake(0, 46, WIDTH -20, 1)];
    self.separatedView.backgroundColor = [UIColor whiteColor];
    self.separatedView.alpha = 0.5;
    [self.nameTextBackground addSubview:self.separatedView];
/**密码输入框*/
    self.passWordTextField = [[UITextField alloc]initWithFrame:CGRectMake(55, 45, WIDTH - 75, 45)];
    self.passWordTextField.backgroundColor =[UIColor grayColor];
    self.passWordTextField.alpha = 0.3;
    [self.nameTextBackground addSubview:self.passWordTextField];
    
/**密码图片*/
    self.passWordImageView = [[UIImageView alloc]initWithFrame:CGRectMake(12, 52, 30, 35)];
    self.passWordImageView.backgroundColor = [UIColor clearColor];
    self.passWordImageView.image = [UIImage imageNamed:@"ST3x.png"];
    [self.nameTextBackground addSubview:self.passWordImageView];

/**忘记登录密码*/
    self.forgotPasswordButton = [UIButton buttonWithType:UIButtonTypeCustom];
    self.forgotPasswordButton.frame = CGRectMake(300, 480, 90 , 40);
    [self.forgotPasswordButton setTitle:@"忘记密码" forState:UIControlStateNormal];
    [self.forgotPasswordButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
       [self.forgotPasswordButton addTarget:self action:@selector(forgotPasswordButton:) forControlEvents:UIControlEventTouchUpInside];
    
    [self.view addSubview:self.forgotPasswordButton];
/**登录*/
    self.registerButton = [UIButton buttonWithType:UIButtonTypeCustom];
    self.registerButton.frame = CGRectMake(10, 525, WIDTH - 20, 50);
    self.registerButton.backgroundColor = [UIColor colorWithRed:0.00f green:0.68f blue:0.53f alpha:1.00f];
    self.registerButton.layer.cornerRadius = 4;
    [self.view addSubview:self.registerButton];
    [self.registerButton setTitle:@"登录" forState:UIControlStateNormal];
    [self.registerButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    
/**注册*/
    self.registeredButton = [UIButton buttonWithType:UIButtonTypeCustom];
    self.registeredButton.frame = CGRectMake(10, 580, WIDTH - 20, 50);
    self.registeredButton.backgroundColor = [UIColor colorWithRed:0.00 green:0.68 blue:0.53 alpha:1.00];
    self.registeredButton.alpha = 0.3;
    self.registeredButton.layer.cornerRadius = 4;
    [self.view addSubview:self.registeredButton];
    [self.registeredButton setTitle:@"注册拉钩" forState:UIControlStateNormal];
    [self.registeredButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [self.registeredButton addTarget:self action:@selector(registeredButton:) forControlEvents:UIControlEventTouchUpInside];
    
/**OR*/
    self.orLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 50, 50)];
    self.orLabel.backgroundColor = [UIColor clearColor];
    self.orLabel.center = CGPointMake(WIDTH / 2, 650);
    self.orLabel.text = @"or";
    self.orLabel.textAlignment = NSTextAlignmentCenter;
    self.orLabel.font = [UIFont systemFontOfSize:22];
    self.orLabel.textColor = [UIColor whiteColor];
    [self.view addSubview:self.orLabel];
    
/**Or右白线*/
    self.leftWhiteLine = [[UIView alloc] initWithFrame:CGRectMake(10, 650, 170, 2)];
    self.leftWhiteLine.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:self.leftWhiteLine];
/**OR左白线*/
    self.rightWhiteLine = [[UIView alloc] initWithFrame:CGRectMake(414 - 180, 650, 170, 2)];
    self.rightWhiteLine.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:self.rightWhiteLine];

    
    
}

- (void)registeredButton:(UIView *)registeredButton {
    
/**背景*/
    self.backgroundView = [[UIImageView alloc]initWithFrame:[UIScreen mainScreen].bounds];
    self.backgroundView.backgroundColor = [UIColor whiteColor];
    self.backgroundView.image = [UIImage imageNamed:@"welcome_2.jpg"];
    [self.view addSubview:self.backgroundView];
    
    /**LoGo*/
    self.LogoView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, WIDTH / 3 - 10, HEIGHT * 2 / 7)];
    self.LogoView.center = CGPointMake(self.view.frame.size.width / 2, self.view.frame.size.height / 4);
    
    self.LogoView.image = [UIImage imageNamed:@"logo2x.png"];
    [self.view addSubview:self.LogoView];
    /**手机和验证码背景*/
    self.nameTextBackground = [[UIView alloc]initWithFrame:CGRectMake(10, 370, WIDTH - 20, 91)];
    self.nameTextBackground.backgroundColor = [UIColor blackColor];
    self.nameTextBackground.alpha = 0.3;
    [self.view addSubview:self.nameTextBackground];
    /**手机输入框*/
    self.nameTextField = [[UITextField alloc]initWithFrame:CGRectMake(55, 0, WIDTH - 20 - 55, 45)];
    self.nameTextField.backgroundColor = [UIColor grayColor];
    self.nameTextField.alpha = 0.3;
    [self.nameTextBackground addSubview:self.nameTextField];
    /**手机图片*/
    self.nameImageView = [[UIImageView alloc]initWithFrame:CGRectMake(12, 5, 30, 35)];
    self.nameImageView.backgroundColor =[UIColor clearColor];
    self.nameImageView.image = [UIImage imageNamed:@"SJGree.png"];
    [self.nameTextBackground addSubview:self.nameImageView];
    /**分隔线*/
    self.separatedView =[[UIView alloc]initWithFrame:CGRectMake(0, 46, WIDTH -20, 1)];
    self.separatedView.backgroundColor = [UIColor whiteColor];
    self.separatedView.alpha = 0.5;
    [self.nameTextBackground addSubview:self.separatedView];
    /**验证码输入框*/
    self.passWordTextField = [[UITextField alloc]initWithFrame:CGRectMake(55, 45, WIDTH - 75, 45)];
    self.passWordTextField.backgroundColor =[UIColor grayColor];
    self.passWordTextField.alpha = 0.3;
    [self.nameTextBackground addSubview:self.passWordTextField];
    
    /**验证码*/
    self.passWordImageView = [[UIImageView alloc]initWithFrame:CGRectMake(12, 52, 30, 35)];
    self.passWordImageView.backgroundColor = [UIColor clearColor];
    self.passWordImageView.image = [UIImage imageNamed:@"HD.png"];
    [self.nameTextBackground addSubview:self.passWordImageView];


    /**注册*/
    self.registerButton = [UIButton buttonWithType:UIButtonTypeCustom];
    self.registerButton.frame = CGRectMake(10, 525, WIDTH - 20, 50);
    self.registerButton.backgroundColor = [UIColor colorWithRed:0.00f green:0.68f blue:0.53f alpha:1.00f];
    self.registerButton.layer.cornerRadius = 4;
    [self.view addSubview:self.registerButton];
    [self.registerButton setTitle:@"注册" forState:UIControlStateNormal];
    [self.registerButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    
    /**返回登录*/
    self.registeredButton = [UIButton buttonWithType:UIButtonTypeCustom];
    self.registeredButton.frame = CGRectMake(10, 580, WIDTH - 20, 50);
    self.registeredButton.backgroundColor = [UIColor colorWithRed:0.00 green:0.68 blue:0.53 alpha:1.00];
    self.registeredButton.alpha = 0.3;
    self.registeredButton.layer.cornerRadius = 4;
    [self.view addSubview:self.registeredButton];
    [self.registeredButton setTitle:@"返回登录" forState:UIControlStateNormal];
    [self.registeredButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
       [self.registeredButton addTarget:self action:@selector(viewDidLoad) forControlEvents:UIControlEventTouchUpInside];

    
}


- (void)forgotPasswordButton:(UIView *)forgotPasswordButton {

    
/**忘记背景*/
    self.forgotPasswordView = [[UIImageView alloc]initWithFrame:[UIScreen mainScreen].bounds];
    self.forgotPasswordView.backgroundColor = [UIColor whiteColor];
    
    [self.view addSubview:self.forgotPasswordView];
/**返回键*/
    self.returnButton = [UIButton buttonWithType:UIButtonTypeCustom];
    self.returnButton.frame =CGRectMake(0, 10, 60, 60);
    self.returnButton.backgroundColor = [UIColor whiteColor];
    [self.returnButton setImage:[UIImage imageNamed:@"icon_pop_login@2x.png"] forState:UIControlStateNormal];
 [self.returnButton addTarget:self action:@selector(viewDidLoad) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:self.returnButton];
    
    /**验证手机*/
    self.validationPhone = [[UILabel alloc]initWithFrame:CGRectMake(175 , 70, 80, 60)];
    self.validationPhone.backgroundColor = [UIColor whiteColor];
    self.validationPhone.text = @"验证手机";
//    self.validationPhone.textAlignment = NSTextAlignmentCenter;
    self.validationPhone.font = [UIFont systemFontOfSize:20];
    self.validationPhone.textColor = [UIColor blackColor];
    [self.view addSubview:self.validationPhone];

    
    
    /**手机和验证码背景*/
    self.nameTextBackground = [[UIView alloc]initWithFrame:CGRectMake(10, 150, WIDTH - 20, 91)];
    self.nameTextBackground.backgroundColor = [UIColor blackColor];
    self.nameTextBackground.alpha = 0.3;
    [self.view addSubview:self.nameTextBackground];
    /**手机输入框*/
    self.nameTextField = [[UITextField alloc]initWithFrame:CGRectMake(55, 0, WIDTH - 20 - 55, 45)];
    self.nameTextField.backgroundColor = [UIColor whiteColor];
    self.nameTextField.alpha = 0.3;
    [self.nameTextBackground addSubview:self.nameTextField];
    /**手机图片*/
    self.nameImageView = [[UIImageView alloc]initWithFrame:CGRectMake(12, 5, 30, 35)];
    self.nameImageView.backgroundColor =[UIColor clearColor];
    self.nameImageView.image = [UIImage imageNamed:@"SJGree.png"];
    [self.nameTextBackground addSubview:self.nameImageView];
    /**分隔线*/
    self.separatedView =[[UIView alloc]initWithFrame:CGRectMake(0, 46, WIDTH -20, 1)];
    self.separatedView.backgroundColor = [UIColor redColor];
//    self.separatedView.alpha = 0.5;
    [self.nameTextBackground addSubview:self.separatedView];
    /**验证码输入框*/
    self.passWordTextField = [[UITextField alloc]initWithFrame:CGRectMake(55, 45, WIDTH - 75, 45)];
    self.passWordTextField.backgroundColor =[UIColor whiteColor];
    self.passWordTextField.alpha = 0.3;
    [self.nameTextBackground addSubview:self.passWordTextField];
    self.separatedView = [[UIView alloc]initWithFrame:CGRectMake(0, 96, WIDTH -20, 1)];
    self.separatedView.backgroundColor = [UIColor redColor];
    [self.nameTextField addSubview:self.separatedView];
    
    /**验证码*/
    self.passWordImageView = [[UIImageView alloc]initWithFrame:CGRectMake(12, 52, 30, 35)];
    self.passWordImageView.backgroundColor = [UIColor clearColor];
    self.passWordImageView.image = [UIImage imageNamed:@"HD.png"];
    [self.nameTextBackground addSubview:self.passWordImageView];

    
    /**下一步*/
    self.nextSteplButton = [UIButton buttonWithType:UIButtonTypeCustom];
    self.nextSteplButton.frame = CGRectMake(10, 250, WIDTH - 20, 50);
    self.nextSteplButton.backgroundColor = [UIColor colorWithRed:0.00 green:0.68 blue:0.53 alpha:1.00];
//    self.nextSteplButton.alpha = 0.3;
    self.nextSteplButton.layer.cornerRadius = 4;
    [self.view addSubview:self.nextSteplButton];
    [self.nextSteplButton setTitle:@"下一步" forState:UIControlStateNormal];
    [self.nextSteplButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [self.nextSteplButton addTarget:self action:@selector(nextSteplButton:) forControlEvents:UIControlEventTouchUpInside];


}

- (void)nextSteplButton:(UIView *)nextSteplButton {
    NSLog(@"已经实现");
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
